Shared: Nicer panic message if node kind is missing#21815
Open
asgerf wants to merge 2 commits into
Open
Conversation
Still panics, just with a better message
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
Rerun has been triggered: 2 restarted 🚀 |
1 similar comment
Contributor
Author
Rerun has been triggered: 2 restarted 🚀 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves debuggability of the shared tree-sitter extractor by replacing an unhelpful None.unwrap() panic with a clearer message when a node kind is missing from the extractor schema.
Changes:
- Introduces a
type_namelocal used for schema lookup. - Replaces
.unwrap()with.unwrap_or_else(...)to panic with a more descriptive message including the missingTypeName.
Show a summary per file
| File | Description |
|---|---|
| shared/tree-sitter-extractor/src/extractor/mod.rs | Improves panic messaging when a node kind is missing from the extractor schema map. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
| @@ -479,13 +479,14 @@ impl<'a> Visitor<'a> { | |||
| let (id, _, child_nodes) = self.stack.pop().expect("Vistor: empty stack"); | |||
Contributor
Author
There was a problem hiding this comment.
Not related to this PR
hvitved
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the shared tree-sitter extractor, a panic is raised if we encounter a node that is not present in the target schema. The message is just a generic failure from calling
None.unwrap()however, so it's not very helpful. This PR replaces it with a more helpful panic message.